package com.mdd.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mdd.admin.LikeAdminThreadLocal;
import com.mdd.admin.validate.commons.PageValidate;
import com.mdd.admin.service.ICustomerDetailService;
import com.mdd.admin.validate.customer.CustomerDetailCreateValidate;
import com.mdd.admin.validate.customer.CustomerDetailUpdateValidate;
import com.mdd.admin.validate.customer.CustomerDetailSearchValidate;
import com.mdd.admin.vo.customer.CustomerDetailListedVo;
import com.mdd.admin.vo.customer.CustomerDetailDetailVo;
import com.mdd.common.core.PageResult;
import com.mdd.common.entity.CustomerDetail;
import com.mdd.common.mapper.CustomerDetailMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import javax.annotation.Resource;
import java.util.*;

/**
 * 客户详情实现类
 * @author jiejie
 */
@Service
public class CustomerDetailServiceImpl implements ICustomerDetailService {

    @Resource
    CustomerDetailMapper customerDetailMapper;

    /**
     * 客户详情列表
     *
     * @author jiejie
     * @param pageValidate 分页参数
     * @param searchValidate 搜索参数
     * @return PageResult<CustomerDetailListedVo>
     */
    @Override
    public PageResult<CustomerDetailListedVo> list(PageValidate pageValidate, CustomerDetailSearchValidate searchValidate) {
        Integer page  = pageValidate.getPageNo();
        Integer limit = pageValidate.getPageSize();

        QueryWrapper<CustomerDetail> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("is_delete", 0);
        queryWrapper.orderByDesc("id");

        customerDetailMapper.setSearch(queryWrapper, searchValidate, new String[]{
            "=:mianId@mian_id:int",
            "=:consultancy:str",
            "=:scale:str",
            "=:contributedCapital@contributed_capital:str",
            "=:numberOfEmployees@number_of_employees:str",
            "=:creditCode@credit_code:str",
            "=:companyUrl@company_url:str",
            "=:companyEmail@company_email:str",
            "=:upstreamProducts@upstream_products:str",
            "=:downstreamProduct@downstream_product:str",
            "=:province:str",
            "=:city:str",
            "=:county:str",
            "=:address:str",
            "=:breachOfTrust@breach_of_trust:str",
            "=:isParkBase@is_park_base:str",
            "like:parkOrBaseName@park_or_base_name:str",
            "=:isDirectMatching@is_direct_matching:str",
            "=:platform:str",
            "=:mainProductId@main_product_id:str",
            "like:firmName@firm_name:str",
            "=:projectApplication@project_application:str",
            "=:projectApplicationOther@project_application_other:str",
            "=:managementSystemCertification@management_system_certification:str",
            "=:managementSystemCertificationOther@management_system_certification_other:str",
            "=:authorityCertification@authority_certification:str",
            "=:authorityCertificationOther@authority_certification_other:str",
            "=:institutions:str",
            "=:useSystem@use_system:str",
            "=:systemIntegrated@system_integrated:str",
            "=:systemDeviceIntegrated@system_device_integrated:str",
            "=:implementingStandard@implementing_standard:str",
            "=:honorsProgram@honors_program:str",
            "=:linkman:str",
            "=:sex:str",
            "=:phone:str",
            "=:wechat:str",
            "=:email:str",
            "=:fax:str",
            "=:specialPlane@special_plane:str",
            "=:patentOperation@patent_operation:str",
            "=:intellectualTableData@intellectual_table_data:str",
            "=:isStandardizedUnderlyingDesign@is_standardized_underlying_design:str",
            "=:standardSystemTableData@standard_system_table_data:str",
            "=:hrWorkCount@hr_work_count:str",
            "=:hrSecurityCount@hr_security_count:str",
            "=:hrIndividualCount@hr_individual_count:str",
            "=:hrDevelopmentCount@hr_development_count:str",
            "=:hrTableData@hr_table_data:str",
            "=:institutionsIsCooperation@institutions_is_cooperation:str",
            "=:institutionsIsTechnicalDemand@institutions_is_technical_demand:str",
            "=:institutionsIsAchievement@institutions_is_achievement:str",
            "=:institutionsIsOrganization@institutions_is_organization:str",
            "=:institutionsIsDeclaration@institutions_is_declaration:str",
            "=:institutionsDevelopmentProject@institutions_development_project:str",
            "like:institutionsDevelopmentName@institutions_development_name:str",
            "=:institutionsAscertainmentSituation@institutions_ascertainment_situation:str",
            "=:institutionsFoundingTime@institutions_founding_time:str",
            "=:institutionsDeviceMoney@institutions_device_money:str",
            "=:institutionsSiteArea@institutions_site_area:str",
            "=:institutionsDevelopmentCount@institutions_development_count:str",
            "=:institutionsTableData@institutions_table_data:str",
            "=:institutionsTechnicalResearcherNational@institutions_technical_researcher_national:str",
            "=:institutionsTechnicalResearcherProvincial@institutions_technical_researcher_provincial:str",
            "=:institutionsTechnicalResearcherSelfbuild@institutions_technical_researcher_selfbuild:str",
            "=:institutionsEnterpriseTechnologyNational@institutions_enterprise_technology_national:str",
            "=:institutionsEnterpriseTechnologyProvince@institutions_enterprise_technology_province:str",
            "=:institutionsEnterpriseTechnologySelfbuild@institutions_enterprise_technology_selfbuild:str",
            "=:institutionsEnterpriseCenterNational@institutions_enterprise_center_national:str",
            "=:institutionsEnterpriseCenterProvince@institutions_enterprise_center_province:str",
            "=:institutionsEnterpriseCenterSelfbuild@institutions_enterprise_center_selfbuild:str",
            "=:institutionsIndustrialDesignNational@institutions_industrial_design_national:str",
            "=:institutionsIndustrialDesignProvince@institutions_industrial_design_province:str",
            "=:institutionsIndustrialDesignSelfbuild@institutions_industrial_design_selfbuild:str",
            "=:institutionsKeyLaboratoryNational@institutions_key_laboratory_national:str",
            "=:institutionsKeyLaboratoryProvince@institutions_key_laboratory_province:str",
            "=:institutionsKeyLaboratorySelfbuild@institutions_key_laboratory_selfbuild:str",
            "=:institutionsAcademicianExpertWorkstation@institutions_academician_expert_workstation:str",
            "=:institutionsPostdoctoralCentre@institutions_postdoctoral_centre:str",
            "=:managementDeviceMoney@management_device_money:str",
            "=:managementDeviceInvestMoney@management_device_invest_money:str",
            "=:managementPutIntoMoney@management_put_into_money:str",
            "=:managementLandDevelopment@management_land_development:str",
            "=:managementUseDistrict@management_use_district:str",
            "=:managementPlannedConstructionPeriod@management_planned_construction_period:str",
            "=:managementListingSituation@management_listing_situation:str",
            "=:managementListingPlan@management_listing_plan:str",
            "=:managementIntendedListingPlace@management_Intended_listing_place:str",
            "=:managementFinancingRequirement@management_financing_requirement:str",
            "=:managementPlanFinancingMethod@management_plan_financing_method:str",
            "=:managementTableData@management_table_data:str",
        });

        IPage<CustomerDetail> iPage = customerDetailMapper.selectPage(new Page<>(page, limit), queryWrapper);

        List<CustomerDetailListedVo> list = new LinkedList<>();
        for(CustomerDetail item : iPage.getRecords()) {
            CustomerDetailListedVo vo = new CustomerDetailListedVo();
            BeanUtils.copyProperties(item, vo);
            list.add(vo);
        }

        return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
    }

    /**
     * 客户详情详情
     *
     * @author jiejie
     * @param id 主键参数
     * @return CustomerDetail
     */
    @Override
    public CustomerDetailDetailVo detail(Integer id) {
        CustomerDetail model = customerDetailMapper.selectOne(
                new QueryWrapper<CustomerDetail>()
                    .eq("id", id)
                    .eq("is_delete", 0)
                    .last("limit 1"));

        Assert.notNull(model, "数据不存在");

        CustomerDetailDetailVo vo = new CustomerDetailDetailVo();
        BeanUtils.copyProperties(model, vo);
        return vo;
    }

    /**
     * 客户详情详情
     *
     * @author wuwu
     * @param mianId 主表主键
     * @return CustomerDetail
     */
    @Override
    public CustomerDetailDetailVo detailByMianId(Integer mianId) {
        CustomerDetail model = customerDetailMapper.selectOne(
                new QueryWrapper<CustomerDetail>()
                        .eq("mian_id", mianId)
                        .eq("is_delete", 0)
                        .last("limit 1"));
        Assert.notNull(model, "数据不存在");
        CustomerDetailDetailVo vo = new CustomerDetailDetailVo();
        BeanUtils.copyProperties(model, vo);
        return vo;
    }



    /**
     * 客户详情新增
     *
     * @author jiejie
     * @param createValidate 参数
     */
    @Override
    public void add(CustomerDetailCreateValidate createValidate) {
        CustomerDetail model = new CustomerDetail();
        model.setMianId(createValidate.getMianId());
        model.setConsultancy(createValidate.getConsultancy());
        model.setScale(createValidate.getScale());
        model.setContributedCapital(createValidate.getContributedCapital());
        model.setNumberOfEmployees(createValidate.getNumberOfEmployees());
        model.setCreditCode(createValidate.getCreditCode());
        model.setCompanyUrl(createValidate.getCompanyUrl());
        model.setCompanyEmail(createValidate.getCompanyEmail());
        model.setUpstreamProducts(createValidate.getUpstreamProducts());
        model.setDownstreamProduct(createValidate.getDownstreamProduct());
        model.setProvince(createValidate.getProvince());
        model.setCity(createValidate.getCity());
        model.setCounty(createValidate.getCounty());
        model.setAddress(createValidate.getAddress());
        model.setBreachOfTrust(createValidate.getBreachOfTrust());
        model.setIsParkBase(createValidate.getIsParkBase());
        model.setParkOrBaseName(createValidate.getParkOrBaseName());
        model.setIsDirectMatching(createValidate.getIsDirectMatching());
        model.setPlatform(createValidate.getPlatform());
        model.setMainProductId(createValidate.getMainProductId());
        model.setFirmName(createValidate.getFirmName());
        model.setProjectApplication(createValidate.getProjectApplication());
        model.setProjectApplicationOther(createValidate.getProjectApplicationOther());
        model.setManagementSystemCertification(createValidate.getManagementSystemCertification());
        model.setManagementSystemCertificationOther(createValidate.getManagementSystemCertificationOther());
        model.setAuthorityCertification(createValidate.getAuthorityCertification());
        model.setAuthorityCertificationOther(createValidate.getAuthorityCertificationOther());
        model.setInstitutions(createValidate.getInstitutions());
        model.setUseSystem(createValidate.getUseSystem());
        model.setSystemIntegrated(createValidate.getSystemIntegrated());
        model.setSystemDeviceIntegrated(createValidate.getSystemDeviceIntegrated());
        model.setImplementingStandard(createValidate.getImplementingStandard());
        model.setHonorsProgram(createValidate.getHonorsProgram());
        model.setLinkman(createValidate.getLinkman());
        model.setSex(createValidate.getSex());
        model.setPhone(createValidate.getPhone());
        model.setWechat(createValidate.getWechat());
        model.setEmail(createValidate.getEmail());
        model.setFax(createValidate.getFax());
        model.setSpecialPlane(createValidate.getSpecialPlane());
        model.setPatentOperation(createValidate.getPatentOperation());
        model.setIntellectualTableData(createValidate.getIntellectualTableData());
        model.setIsStandardizedUnderlyingDesign(createValidate.getIsStandardizedUnderlyingDesign());
        model.setStandardSystemTableData(createValidate.getStandardSystemTableData());
        model.setHrWorkCount(createValidate.getHrWorkCount());
        model.setHrSecurityCount(createValidate.getHrSecurityCount());
        model.setHrIndividualCount(createValidate.getHrIndividualCount());
        model.setHrDevelopmentCount(createValidate.getHrDevelopmentCount());
        model.setHrTableData(createValidate.getHrTableData());
        model.setInstitutionsIsCooperation(createValidate.getInstitutionsIsCooperation());
        model.setInstitutionsIsTechnicalDemand(createValidate.getInstitutionsIsTechnicalDemand());
        model.setInstitutionsIsAchievement(createValidate.getInstitutionsIsAchievement());
        model.setInstitutionsIsOrganization(createValidate.getInstitutionsIsOrganization());
        model.setInstitutionsIsDeclaration(createValidate.getInstitutionsIsDeclaration());
        model.setInstitutionsDevelopmentProject(createValidate.getInstitutionsDevelopmentProject());
        model.setInstitutionsDevelopmentName(createValidate.getInstitutionsDevelopmentName());
        model.setInstitutionsAscertainmentSituation(createValidate.getInstitutionsAscertainmentSituation());
        model.setInstitutionsFoundingTime(createValidate.getInstitutionsFoundingTime());
        model.setInstitutionsDeviceMoney(createValidate.getInstitutionsDeviceMoney());
        model.setInstitutionsSiteArea(createValidate.getInstitutionsSiteArea());
        model.setInstitutionsDevelopmentCount(createValidate.getInstitutionsDevelopmentCount());
        model.setInstitutionsTableData(createValidate.getInstitutionsTableData());
        model.setInstitutionsTechnicalResearcherNational(createValidate.getInstitutionsTechnicalResearcherNational());
        model.setInstitutionsTechnicalResearcherProvincial(createValidate.getInstitutionsTechnicalResearcherProvincial());
        model.setInstitutionsTechnicalResearcherSelfbuild(createValidate.getInstitutionsTechnicalResearcherSelfbuild());
        model.setInstitutionsEnterpriseTechnologyNational(createValidate.getInstitutionsEnterpriseTechnologyNational());
        model.setInstitutionsEnterpriseTechnologyProvince(createValidate.getInstitutionsEnterpriseTechnologyProvince());
        model.setInstitutionsEnterpriseTechnologySelfbuild(createValidate.getInstitutionsEnterpriseTechnologySelfbuild());
        model.setInstitutionsEnterpriseCenterNational(createValidate.getInstitutionsEnterpriseCenterNational());
        model.setInstitutionsEnterpriseCenterProvince(createValidate.getInstitutionsEnterpriseCenterProvince());
        model.setInstitutionsEnterpriseCenterSelfbuild(createValidate.getInstitutionsEnterpriseCenterSelfbuild());
        model.setInstitutionsIndustrialDesignNational(createValidate.getInstitutionsIndustrialDesignNational());
        model.setInstitutionsIndustrialDesignProvince(createValidate.getInstitutionsIndustrialDesignProvince());
        model.setInstitutionsIndustrialDesignSelfbuild(createValidate.getInstitutionsIndustrialDesignSelfbuild());
        model.setInstitutionsKeyLaboratoryNational(createValidate.getInstitutionsKeyLaboratoryNational());
        model.setInstitutionsKeyLaboratoryProvince(createValidate.getInstitutionsKeyLaboratoryProvince());
        model.setInstitutionsKeyLaboratorySelfbuild(createValidate.getInstitutionsKeyLaboratorySelfbuild());
        model.setInstitutionsAcademicianExpertWorkstation(createValidate.getInstitutionsAcademicianExpertWorkstation());
        model.setInstitutionsPostdoctoralCentre(createValidate.getInstitutionsPostdoctoralCentre());
        model.setManagementDeviceMoney(createValidate.getManagementDeviceMoney());
        model.setManagementDeviceInvestMoney(createValidate.getManagementDeviceInvestMoney());
        model.setManagementPutIntoMoney(createValidate.getManagementPutIntoMoney());
        model.setManagementLandDevelopment(createValidate.getManagementLandDevelopment());
        model.setManagementUseDistrict(createValidate.getManagementUseDistrict());
        model.setManagementPlannedConstructionPeriod(createValidate.getManagementPlannedConstructionPeriod());
        model.setManagementListingSituation(createValidate.getManagementListingSituation());
        model.setManagementListingPlan(createValidate.getManagementListingPlan());
        model.setManagementIntendedListingPlace(createValidate.getManagementIntendedListingPlace());
        model.setManagementFinancingRequirement(createValidate.getManagementFinancingRequirement());
        model.setManagementPlanFinancingMethod(createValidate.getManagementPlanFinancingMethod());
        model.setManagementTableData(createValidate.getManagementTableData());
        model.setUserId(LikeAdminThreadLocal.getAdminId());
        model.setUserName(LikeAdminThreadLocal.get("username").toString());
        model.setCreateTime(String.valueOf(System.currentTimeMillis() / 1000));
        model.setDoctorCount(createValidate.getDoctorCount());
        model.setMasterCount(createValidate.getMasterCount());
        model.setGraduateCount(createValidate.getGraduateCount());
        model.setJuniorCollegeCount(createValidate.getJuniorCollegeCount());
        model.setSeniorHighSchoolCount(createValidate.getSeniorHighSchoolCount());
        model.setTechnicalSecondaryCount(createValidate.getTechnicalSecondaryCount());
        model.setTitleOfASeniorProfessionalPostCount(createValidate.getTitleOfASeniorProfessionalPostCount());
        model.setMediumGradeProfessionalTitleCount(createValidate.getMediumGradeProfessionalTitleCount());
        model.setPrimaryTitleCount(createValidate.getPrimaryTitleCount());
        model.setStudyingAbroadCount(createValidate.getStudyingAbroadCount());
        model.setIsDelete(0);
        customerDetailMapper.insert(model);
    }

    /**
     * 客户详情编辑
     *
     * @author jiejie
     * @param updateValidate 参数
     */
    @Override
    public void edit(CustomerDetailUpdateValidate updateValidate) {
        CustomerDetail model = customerDetailMapper.selectOne(
                new QueryWrapper<CustomerDetail>()
                    .eq("id",  updateValidate.getId())
                    .eq("is_delete", 0)
                    .last("limit 1"));

        Assert.notNull(model, "数据不存在!");

        model.setId(updateValidate.getId());
        model.setMianId(updateValidate.getMianId());
        model.setConsultancy(updateValidate.getConsultancy());
        model.setScale(updateValidate.getScale());
        model.setContributedCapital(updateValidate.getContributedCapital());
        model.setNumberOfEmployees(updateValidate.getNumberOfEmployees());
        model.setCreditCode(updateValidate.getCreditCode());
        model.setCompanyUrl(updateValidate.getCompanyUrl());
        model.setCompanyEmail(updateValidate.getCompanyEmail());
        model.setUpstreamProducts(updateValidate.getUpstreamProducts());
        model.setDownstreamProduct(updateValidate.getDownstreamProduct());
        model.setProvince(updateValidate.getProvince());
        model.setCity(updateValidate.getCity());
        model.setCounty(updateValidate.getCounty());
        model.setAddress(updateValidate.getAddress());
        model.setBreachOfTrust(updateValidate.getBreachOfTrust());
        model.setIsParkBase(updateValidate.getIsParkBase());
        model.setParkOrBaseName(updateValidate.getParkOrBaseName());
        model.setIsDirectMatching(updateValidate.getIsDirectMatching());
        model.setPlatform(updateValidate.getPlatform());
        model.setMainProductId(updateValidate.getMainProductId());
        model.setFirmName(updateValidate.getFirmName());
        model.setProjectApplication(updateValidate.getProjectApplication());
        model.setProjectApplicationOther(updateValidate.getProjectApplicationOther());
        model.setManagementSystemCertification(updateValidate.getManagementSystemCertification());
        model.setManagementSystemCertificationOther(updateValidate.getManagementSystemCertificationOther());
        model.setAuthorityCertification(updateValidate.getAuthorityCertification());
        model.setAuthorityCertificationOther(updateValidate.getAuthorityCertificationOther());
        model.setInstitutions(updateValidate.getInstitutions());
        model.setUseSystem(updateValidate.getUseSystem());
        model.setSystemIntegrated(updateValidate.getSystemIntegrated());
        model.setSystemDeviceIntegrated(updateValidate.getSystemDeviceIntegrated());
        model.setImplementingStandard(updateValidate.getImplementingStandard());
        model.setHonorsProgram(updateValidate.getHonorsProgram());
        model.setLinkman(updateValidate.getLinkman());
        model.setSex(updateValidate.getSex());
        model.setPhone(updateValidate.getPhone());
        model.setWechat(updateValidate.getWechat());
        model.setEmail(updateValidate.getEmail());
        model.setFax(updateValidate.getFax());
        model.setSpecialPlane(updateValidate.getSpecialPlane());
        model.setPatentOperation(updateValidate.getPatentOperation());
        model.setIntellectualTableData(updateValidate.getIntellectualTableData());
        model.setIsStandardizedUnderlyingDesign(updateValidate.getIsStandardizedUnderlyingDesign());
        model.setStandardSystemTableData(updateValidate.getStandardSystemTableData());
        model.setHrWorkCount(updateValidate.getHrWorkCount());
        model.setHrSecurityCount(updateValidate.getHrSecurityCount());
        model.setHrIndividualCount(updateValidate.getHrIndividualCount());
        model.setHrDevelopmentCount(updateValidate.getHrDevelopmentCount());
        model.setHrTableData(updateValidate.getHrTableData());
        model.setInstitutionsIsCooperation(updateValidate.getInstitutionsIsCooperation());
        model.setInstitutionsIsTechnicalDemand(updateValidate.getInstitutionsIsTechnicalDemand());
        model.setInstitutionsIsAchievement(updateValidate.getInstitutionsIsAchievement());
        model.setInstitutionsIsOrganization(updateValidate.getInstitutionsIsOrganization());
        model.setInstitutionsIsDeclaration(updateValidate.getInstitutionsIsDeclaration());
        model.setInstitutionsDevelopmentProject(updateValidate.getInstitutionsDevelopmentProject());
        model.setInstitutionsDevelopmentName(updateValidate.getInstitutionsDevelopmentName());
        model.setInstitutionsAscertainmentSituation(updateValidate.getInstitutionsAscertainmentSituation());
        model.setInstitutionsFoundingTime(updateValidate.getInstitutionsFoundingTime());
        model.setInstitutionsDeviceMoney(updateValidate.getInstitutionsDeviceMoney());
        model.setInstitutionsSiteArea(updateValidate.getInstitutionsSiteArea());
        model.setInstitutionsDevelopmentCount(updateValidate.getInstitutionsDevelopmentCount());
        model.setInstitutionsTableData(updateValidate.getInstitutionsTableData());
        model.setInstitutionsTechnicalResearcherNational(updateValidate.getInstitutionsTechnicalResearcherNational());
        model.setInstitutionsTechnicalResearcherProvincial(updateValidate.getInstitutionsTechnicalResearcherProvincial());
        model.setInstitutionsTechnicalResearcherSelfbuild(updateValidate.getInstitutionsTechnicalResearcherSelfbuild());
        model.setInstitutionsEnterpriseTechnologyNational(updateValidate.getInstitutionsEnterpriseTechnologyNational());
        model.setInstitutionsEnterpriseTechnologyProvince(updateValidate.getInstitutionsEnterpriseTechnologyProvince());
        model.setInstitutionsEnterpriseTechnologySelfbuild(updateValidate.getInstitutionsEnterpriseTechnologySelfbuild());
        model.setInstitutionsEnterpriseCenterNational(updateValidate.getInstitutionsEnterpriseCenterNational());
        model.setInstitutionsEnterpriseCenterProvince(updateValidate.getInstitutionsEnterpriseCenterProvince());
        model.setInstitutionsEnterpriseCenterSelfbuild(updateValidate.getInstitutionsEnterpriseCenterSelfbuild());
        model.setInstitutionsIndustrialDesignNational(updateValidate.getInstitutionsIndustrialDesignNational());
        model.setInstitutionsIndustrialDesignProvince(updateValidate.getInstitutionsIndustrialDesignProvince());
        model.setInstitutionsIndustrialDesignSelfbuild(updateValidate.getInstitutionsIndustrialDesignSelfbuild());
        model.setInstitutionsKeyLaboratoryNational(updateValidate.getInstitutionsKeyLaboratoryNational());
        model.setInstitutionsKeyLaboratoryProvince(updateValidate.getInstitutionsKeyLaboratoryProvince());
        model.setInstitutionsKeyLaboratorySelfbuild(updateValidate.getInstitutionsKeyLaboratorySelfbuild());
        model.setInstitutionsAcademicianExpertWorkstation(updateValidate.getInstitutionsAcademicianExpertWorkstation());
        model.setInstitutionsPostdoctoralCentre(updateValidate.getInstitutionsPostdoctoralCentre());
        model.setManagementDeviceMoney(updateValidate.getManagementDeviceMoney());
        model.setManagementDeviceInvestMoney(updateValidate.getManagementDeviceInvestMoney());
        model.setManagementPutIntoMoney(updateValidate.getManagementPutIntoMoney());
        model.setManagementLandDevelopment(updateValidate.getManagementLandDevelopment());
        model.setManagementUseDistrict(updateValidate.getManagementUseDistrict());
        model.setManagementPlannedConstructionPeriod(updateValidate.getManagementPlannedConstructionPeriod());
        model.setManagementListingSituation(updateValidate.getManagementListingSituation());
        model.setManagementListingPlan(updateValidate.getManagementListingPlan());
        model.setManagementIntendedListingPlace(updateValidate.getManagementIntendedListingPlace());
        model.setManagementFinancingRequirement(updateValidate.getManagementFinancingRequirement());
        model.setManagementPlanFinancingMethod(updateValidate.getManagementPlanFinancingMethod());
        model.setManagementTableData(updateValidate.getManagementTableData());
        model.setUpdateId(LikeAdminThreadLocal.getAdminId());
        model.setUpdateName(LikeAdminThreadLocal.get("username").toString());
        model.setUpdateTime(String.valueOf(System.currentTimeMillis() / 1000));
        model.setDoctorCount(updateValidate.getDoctorCount());
        model.setMasterCount(updateValidate.getMasterCount());
        model.setGraduateCount(updateValidate.getGraduateCount());
        model.setJuniorCollegeCount(updateValidate.getJuniorCollegeCount());
        model.setSeniorHighSchoolCount(updateValidate.getSeniorHighSchoolCount());
        model.setTechnicalSecondaryCount(updateValidate.getTechnicalSecondaryCount());
        model.setTitleOfASeniorProfessionalPostCount(updateValidate.getTitleOfASeniorProfessionalPostCount());
        model.setMediumGradeProfessionalTitleCount(updateValidate.getMediumGradeProfessionalTitleCount());
        model.setPrimaryTitleCount(updateValidate.getPrimaryTitleCount());
        model.setStudyingAbroadCount(updateValidate.getStudyingAbroadCount());
        customerDetailMapper.updateById(model);
    }

    /**
     * 客户详情删除
     *
     * @author jiejie
     * @param id 主键ID
     */
    @Override
    public void del(Integer id) {
        CustomerDetail model = customerDetailMapper.selectOne(
                new QueryWrapper<CustomerDetail>()
                    .eq("id", id)
                    .eq("is_delete", 0)
                    .last("limit 1"));

        Assert.notNull(model, "数据不存在!");

        model.setIsDelete(1);
        model.setDeleteTime(String.valueOf(System.currentTimeMillis() / 1000));
        customerDetailMapper.updateById(model);
    }

}
